﻿

using Ccteg.Common;
using Ccteg.Common.QueryModels.DncPermission;

using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Console;
using Microsoft.Extensions.Logging.Debug;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Diagnostics;
using System.Linq;
using System.Reflection;

namespace Ccteg.DB
{
    /// <summary>
    /// 
    /// </summary>
    public class MySqlDbContext : DbContext
    {


        /// <summary>
        /// 
        /// </summary>
        /// <param name="options"></param>
        public MySqlDbContext(DbContextOptions<MySqlDbContext> options) : base(options)
        {

        }

        /// <summary>
        /// 任务下发
        /// </summary>
        public DbSet<sfm_job> Sfm_Job { get; set; }



        /// <summary>
        /// 
        /// </summary>
        /// <param name="modelBuilder"></param>
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {

            modelBuilder.Entity<sfm_job>(e => { e.HasQueryFilter(x => x.Status == 0); });
            modelBuilder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly());

            base.OnModelCreating(modelBuilder);

        }
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {

            base.OnConfiguring(optionsBuilder);


        }

    }
}
